/**
 * com.cnhis.his.customer.service.Rad1Service.java
 */
package com.mbmed.doctor.homepage.service;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.mbmed.doctor.homepage.bo.Rad1Bo;
import com.mbmed.doctor.homepage.mapper.Rad1;

/**
 * @file  Rad1Service.java
 * @author 刘武
 * @version 0.1
 * @todo	Rad1服务操作接口
 * Copyright(C), 2013-2014
 *		 Shenzhen Coordinates Software Development Co., Ltd.
 * History
 *   	1. Date: 2014-10-15 05:15:48
 *      	Author: 刘武
 *      	Modification: this file was created
 *   	2. ...
 */
@Path("/rad1")
@Component
public class Rad1Service {
	
	private static Logger logger = Logger.getLogger(Rad1.class);
	
	@Autowired
	private Rad1Bo rad1Bo;
	
	@Context
	Request request;

	
	/**
	 * 查找所有数据库记录
     * @return type : List 返回查询操作所有符合条件的记录的VO对象集合，操作失败返回null
     */
	@GET
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Rad1> getAll() throws Exception{
        List<Rad1> list = new ArrayList<Rad1>();
        return rad1Bo.getAll();        
    }
	
    /**
     * 查找符合条件的所有数据库记录
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public Rad1 getRad1(@PathParam("id") String id) throws Exception{
    	Rad1 rad1 = null;
    	return rad1Bo.get(id);        
    }
    /**
     * 向数据库中插入一条记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : 返回插入操作是否成功
     * @throws Exception
     */
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	public Rad1 saveRad1(
			@FormParam("rad01") java.lang.Integer rad01,
			@FormParam("vaa07") java.lang.Integer vaa07,
			@FormParam("vap01") java.lang.Integer vap01,
			@FormParam("rownr") java.lang.Integer rownr,
			@FormParam("rad05") java.lang.String rad05,
			@FormParam("abw01") java.lang.String abw01,
			@FormParam("rad07") java.util.Date rad07,
			@FormParam("rad08") java.lang.Byte rad08,
			@FormParam("rad09") java.lang.String rad09,
			@FormParam("rad10") java.lang.Byte rad10,
			@FormParam("rad11") java.lang.Byte rad11,
			@FormParam("rad12") java.math.BigDecimal rad12,
			@FormParam("rad13") java.lang.Byte rad13,
			@FormParam("rad14") java.math.BigDecimal rad14,
			@FormParam("rad15") java.lang.Byte rad15,
			@FormParam("rad16") java.lang.Byte rad16,
			@FormParam("rad17") java.lang.Byte rad17,
			@FormParam("rad18") java.lang.Byte rad18,
			@FormParam("rad19") java.lang.Byte rad19,
			@FormParam("rad20") java.lang.String rad20,
			@FormParam("rad21") java.math.BigDecimal rad21,
			@FormParam("rad22") java.math.BigDecimal rad22,
			@FormParam("rad23") java.lang.Byte rad23,
			@FormParam("rad24") java.lang.Byte rad24,
			@FormParam("rad25") java.lang.Integer rad25,
			@FormParam("rad26") java.lang.Integer rad26,
			@FormParam("rad27") java.lang.Integer rad27,
			@FormParam("rad28") java.lang.Integer rad28,
			@FormParam("rad29") java.lang.Integer rad29,
			@FormParam("rad30") java.lang.String rad30,
			@FormParam("rad31") java.lang.Integer rad31,
			@FormParam("rad32") java.lang.Byte rad32,
			@FormParam("rad33") java.lang.Integer rad33,
			@FormParam("rad34") java.math.BigDecimal rad34,
			@FormParam("rad35") java.util.Date rad35,
			@FormParam("rad36") java.lang.String rad36,
			@Context HttpServletResponse servletResponse
	) throws Exception {
		Rad1 rad1 = new Rad1();
		rad1.setRad01(rad01);
		rad1.setVaa07(vaa07);
		rad1.setVap01(vap01);
		rad1.setRownr(rownr);
		rad1.setRad05(rad05);
		rad1.setAbw01(abw01);
		rad1.setRad07(rad07);
		rad1.setRad08(rad08);
		rad1.setRad09(rad09);
		rad1.setRad10(rad10);
		rad1.setRad11(rad11);
		rad1.setRad12(rad12);
		rad1.setRad13(rad13);
		rad1.setRad14(rad14);
		rad1.setRad15(rad15);
		rad1.setRad16(rad16);
		rad1.setRad17(rad17);
		rad1.setRad18(rad18);
		rad1.setRad19(rad19);
		rad1.setRad20(rad20);
		rad1.setRad21(rad21);
		rad1.setRad22(rad22);
		rad1.setRad23(rad23);
		rad1.setRad24(rad24);
		rad1.setRad25(rad25);
		rad1.setRad26(rad26);
		rad1.setRad27(rad27);
		rad1.setRad28(rad28);
		rad1.setRad29(rad29);
		rad1.setRad30(rad30);
		rad1.setRad31(rad31);
		rad1.setRad32(rad32);
		rad1.setRad33(rad33);
		rad1.setRad34(rad34);
		rad1.setRad35(rad35);
		rad1.setRad36(rad36);

		return rad1 = rad1Bo.save(rad1);

	}
	/**
     * 删除数据库中与传入的值对象对应的记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : boolean 返回删除操作是否成功
     * @throws Exception
     */
	@DELETE
	@Path("{id}")
	public boolean removeRad1(@PathParam("id") String id) throws Exception{
		if(id == null) return false;
    	return rad1Bo.remove(id);

	}
	
}
